<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>将 obejct 对象中属性是空字符串的替换为 null</title>
</head>
<body>
    <script>
        var obj = {
            name: ' ',// 创建一个obj对象
            age: 18
        }
        if(obj.name = ' '){// 判断obj对象的name属性值等于空字符串时，name值等于nul
            obj.name = null;
        }
        console.log(obj);// 再次输出obj对象
    </script>
</body>
</html>